package com.zfast.config.junit;

import com.zfast.config.vo.CommonResult;
import com.zfast.config.vo.PageBean;
import com.zfast.forge.pojo.co.TestCommonObject;
import com.zfast.forge.pojo.so.TestSpecialObject;
import org.junit.jupiter.api.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author zgn
 * @Description: SimJunit
 * @date 2022/1/13 0013
 */
public class SimJunit {
    @Test
    public void egMin() {//e.g.
        System.out.println();
    }

    @Test
    public void egMax() {//e.g.
        //region 模拟数据
        System.out.println("--------------------Start--------------------");
        //endregion

        //region 数据处理
        System.out.println("--------------------Deal--------------------");
        //endregion

        //region 数据展示
        System.out.println("--------------------Done--------------------");
        //endregion
    }

    @Test
    public void play_egMin() {//e.g.
        System.out.println("this must be your first blood");
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }

    @Test
    public void 账号加密规则_egMin() {//e.g.
        String password="123";
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

        String encode1 = bCryptPasswordEncoder.encode(password);
        boolean equals = encode1.equals("$2a$10$EoeTmeoeNPBDH2g5qM.tYuQAkkQTi/uL..WszntwqEHzQkkAMPScC");
        System.out.println(String.format("encode1:%s;\n是否相等:%s;",encode1, equals));
    }

    @Test
    public void 测试lombok_egMin() {//结论:@Data 标签下会优先已经存在的同名方法
        PageBean pageBean=new PageBean(8,5);
        System.out.println(pageBean.getTotalno());
        pageBean.setTotalsize(7);
        System.out.println(pageBean.getTotalno());
    }

    @Test
    public void 测试CommonResult_egMin() {//e.g.
        CommonResult commonResult=new CommonResult();
        commonResult.ajaxFalse("请选择角色");
        System.out.println(commonResult.getMessage());
    }

    @Test
    public void 泛型的父类继承_egMin() {//e.g.
        TestSpecialObject specialObject=TestSpecialObject.builder().build();
        specialObject.get("子类");

        TestCommonObject commonObject=TestCommonObject.builder().build();
        commonObject.get("父类");
    }

    @Test
    public void 接口的父类继承_egMin() {//e.g.
        TestSpecialObject specialObject=TestSpecialObject.builder().build();
        specialObject.eat();

        TestCommonObject commonObject=TestCommonObject.builder().build();
        commonObject.eat();
    }
}
